import request from '../../views/components/utils/request.js'

// 查询单位抽签列表
export function listRandom(query) {
  return request({
    url: '/unit/random/list',
    method: 'get',
    params: query
  })
}

// 查询单位抽签详细
export function getRandom(randomId) {
  return request({
    url: '/unit/random/' + randomId,
    method: 'get'
  })
}

// 新增单位抽签
export function addRandom(data) {
  return request({
    url: '/unit/random',
    method: 'post',
    data: data
  })
}

// 修改单位抽签
export function updateRandom(data) {
  return request({
    url: '/unit/random',
    method: 'put',
    data: data
  })
}

// 删除单位抽签
export function delRandom(randomId) {
  return request({
    url: '/unit/random/' + randomId,
    method: 'delete'
  })
}

// 新增招标人代表抽签
export function addAgentRandom(data) {
  return request({
    url: '/unit/random/addAgentRandom',
    method: 'post',
    data: data
  })
}

//重置抽签结果
export function reback(randomId) {
  return request({
    url: '/unit/random/reback' + randomId,
    method: 'delete'
  })
}
// 导出单位抽签
export function exportRandom(query) {
  return request({
    url: '/unit/random/export',
    method: 'get',
    params: query
  })
}
//排除集合
export function getRandomMsg(data) {
  return request({
    url: '/unit/random/getRandomMsg',
    method: 'post',
    data: data
  })
}
//还原
export function DeleteMapping(query) {
  return request({
    url: '/unit/random/recover',
    method: 'get',
    params: query
  })
}

// 确认中标单位
export function Bidding(data) {
  return request({
    url: '/unit/random/bidding',
    method: 'post',
    data: data
  })
}

//查询每月抽取单位数量变化
export function getNumberChange(query) {
  return request({
    url: '/unit/random/count/extractChange',
    method: 'get',
    params: query
  })
}

//查询每月抽取单位数量
export function getMonthNumber(data) {
  return request({
    url: '/unit/random/count/extractDown',
    method: 'post',
    data: data
  })
}

//查询每月每个库下抽取单位数量
export function getThisMonthNumber(data) {
  return request({
    url: '/unit/random/count/extractNum',
    method: 'post',
    data: data
  })
}

//查询当月每个库下抽取单位数量
export function getMonthUnitnumber(data) {
  return request({
    url: '/unit/random/extractSumes',
    method: 'post',
    data: data
  })
}

//查询每月每个库下抽取单位数量
export function getQualified(query) {
  return request({
    url: '/unit/random/count/show',
    method: 'get',
    params: query
  })
}

export function getQualiunitType(query) {
  return request({
    url: '/unit/random/count/unitType',
    method: 'get',
    params: query
  })
}
export function getQualiunitscoreList(query) {
  return request({
    url: '/unit/random/count/scoreList',
    method: 'get',
    params: query
  })
}


// 导出表格
export function getExcelTable(query) {
  return request({
    url: '/unit/random/exportExcel',
    method: 'get',
    params: query,
    responseType: "arraybuffer"
  })
}

//预览抽签结果列表
export function getExcelList(data) {
  return request({
    url: '/unit/random/sampleSurvey',
    method: 'post',
    data: data
  })
}

// 查询中签结果
export function getRandomresult(data) {
  return request({
    url: '/unit/random/resultsquery ',
    method: 'post',
    data: data,
  })
}

//查询当前当月抽签详情
export function getMonthrandom(query) {
  return request({
    url: '/unit/random/extractList',
    method: 'get',
    params: query
  })
}

// 查询处罚单位列表
export function getApplyPunish(data) {
  return request({
    url: '/unit/random/applyforPunish',
    method: 'post',
    data: data,
  })
}

// 提交保存处罚结果
export function getPunish(data) {
  return request({
    url: '/unit/random/punish',
    method: 'post',
    data: data,
  })
}

// 删除处罚申请
export function getRandomdelete(randomId) {
  return request({
    url: '/unit/random/delete/' + randomId,
    method: 'get'
  })
}

export function retreatRandom(data) {
  return request.put("/unit/extract/back", data)
}

export function getDeptExtractList(params) {
  return request.get("/unit/random/deptExtractList", { params });
}

export function getRandomName(params) {
  return request.get("/unit/random/getRandomNameByRandomId", { params });
}

export function getAgentInfo(params) {
  return request.get("/unit/random/tenderingAgentlist", { params });
}

export function getAgentList(params) {
  return request.get("/system/agent/list", { params });
}
export function addAgent(data) {
  return request.post("/system/agent/add", data);
}
export function editAgent(data) {
  return request.put("/system/agent", data);
}
export function delAgent(agentids) {
  return request.delete("/system/agent/" + agentids);
}